<template>
	<view class="page">
		<!-- 蓝色头部区域 -->
		<view class="header-section">
			<view class="balance-info">
				<text class="balance-amount">{{currentBalance}}</text>
				<text class="balance-label">当前现金余额(元)</text>
				<view class="withdraw-btn" @click="withdraw">
					<text class="withdraw-text">提现</text>
				</view>
			</view>
			<view class="divider-line"></view>
			<view class="summary-info">
				<text class="summary-item">累计收入(元) : {{totalIncome}}元</text>
				<text class="summary-item">累计提现(元) : {{totalWithdraw}}元</text>
			</view>
		</view>
		
		<!-- 收支明细区域 -->
		<view class="income-detail-section">
			<view class="title-section">
				<text class="section-title">收支明细</text>
				<view class="title-line"></view>
			</view>
			<view class="income-list">
				<view 
					class="income-item" 
					v-for="(item, index) in incomeList" 
					:key="index"
					@click="viewDetail(item)"
				>
					<view class="item-left">
						<text class="item-description">{{item.description}}</text>
						<text class="item-time">{{item.timeLabel}}:{{item.time}}</text>
					</view>
					<view class="item-right">
						<text class="item-amount">+ {{item.amount}}</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				currentBalance: 1500,
				totalIncome: 1700,
				totalWithdraw: 200,
				incomeList: [
					{
						description: 'XX车辆清洗、抛光打蜡服务',
						timeLabel: '核销时间',
						time: '2022-10-12 11:09',
						amount: '50.00'
					},
					{
						description: '提现',
						timeLabel: '提现时间',
						time: '2022-10-12 11:09',
						amount: '200.00'
					},
					{
						description: 'XX车辆清洗、抛光打蜡服务',
						timeLabel: '核销时间',
						time: '2022-10-12 11:09',
						amount: '50.00'
					},
					{
						description: 'XX车辆清洗、抛光打蜡服务',
						timeLabel: '核销时间',
						time: '2022-10-12 11:09',
						amount: '50.00'
					},
					{
						description: 'XX车辆维修、更换机油服务',
						timeLabel: '核销时间',
						time: '2022-10-11 14:30',
						amount: '120.00'
					},
					{
						description: 'XX车辆保养、四轮定位服务',
						timeLabel: '核销时间',
						time: '2022-10-11 09:15',
						amount: '80.00'
					},
					{
						description: '提现',
						timeLabel: '提现时间',
						time: '2022-10-10 16:45',
						amount: '100.00'
					},
					{
						description: 'XX车辆美容、内饰清洁服务',
						timeLabel: '核销时间',
						time: '2022-10-10 10:20',
						amount: '60.00'
					}
				]
			}
		},
		methods: {
			// 提现功能
			withdraw() {
				uni.navigateTo({
					url: '/pages/wjq/withdraw/withdraw'
				});
			},
			// 查看详情
			viewDetail(item) {
				uni.showToast({
					title: `查看${item.description}详情`,
					icon: 'none'
				});
			}
		}
	}
</script>

<style>
	.page {
		background-color: #f5f5f5;
		min-height: 100vh;
	}
	
	/* 蓝色头部区域 */
	.header-section {
		background-color: #007AFF;
		padding: 40rpx 30rpx;
		display: flex;
		justify-content: center;
		align-items: center;
	}
	
	.balance-info {
		display: flex;
		flex-direction: column;
		align-items: center;
		flex: 1;
	}
	
	.balance-amount {
		font-size: 60rpx;
		font-weight: bold;
		color: white;
		margin-bottom: 10rpx;
	}
	
	.balance-label {
		font-size: 24rpx;
		color: rgba(255, 255, 255, 0.8);
		margin-bottom: 30rpx;
	}
	
	.withdraw-btn {
		background-color: #FF9500;
		padding: 12rpx 60rpx;
		border-radius: 25rpx;
		width: 110rpx;
		display: flex;
		justify-content: center;
		align-items: center;
	}
	
	.withdraw-text {
		font-size: 28rpx;
		color: white;
		font-weight: bold;
	}
	
	.divider-line {
		width: 2rpx;
		height: 120rpx;
		background-color: rgba(255, 255, 255, 0.3);
		margin: 0 30rpx;
	}
	
	.summary-info {
		display: flex;
		flex-direction: column;
		align-items: center;
		flex: 1;
	}
	
	.summary-item {
		font-size: 26rpx;
		color: white;
		margin-bottom: 15rpx;
		text-align: center;
	}
	
	/* 收支明细区域 */
	.income-detail-section {
		background-color: white;
		margin: 20rpx 30rpx;
		border-radius: 20rpx;
		padding: 30rpx;
		box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.1);
	}
	
	.title-section {
		/* margin-bottom: 10rpx; */
	}
	
	.section-title {
		font-size: 36rpx;
		font-weight: bold;
		color: #333;
		margin-bottom: 15rpx;
	}
	
	.title-line {
		width: 100%;
		margin-top: 10rpx;
		height: 4rpx;
		background-color: #E5E5E5;
	}
	
	.income-list {
		
	}
	
	.income-item {
		display: flex;
		justify-content: space-between;
		align-items: flex-start;
		padding: 25rpx 0;
		border-bottom: 1rpx solid #f0f0f0;
	}
	
	.income-item:last-child {
		border-bottom: none;
	}
	
	.item-left {
		flex: 1;
		display: flex;
		flex-direction: column;
	}
	
	.item-description {
		font-size: 28rpx;
		color: #333;
		margin-bottom: 10rpx;
		line-height: 1.4;
	}
	
	.item-time {
		font-size: 24rpx;
		color: #999;
	}
	
	.item-right {
		display: flex;
		align-items: center;
		margin-left: 20rpx;
	}
	
	.item-amount {
		font-size: 32rpx;
		font-weight: bold;
		color: #34C759;
	}
</style>